;Koliko puta se u zapisu trocifrenog broja pojavljuje cifra 3
%include "io.inc"
section .data
a: dd 0
b: dd 1
c: dd 3
d: dd 10
section .text
global CMAIN
CMAIN:
    mov ebp, esp; for correct debugging
       GET_DEC 4,a
       mov eax,[a]
       mov ebx,[d]
       mov ecx,[c]
       mov edx,0
       idiv ebx
       mov ecx,0
       mov [a],ecx                
       mov ecx,3                    
       mov ebx,0             
       cmp edx,ecx                    
       jne nastavi
       mov ecx,[b]
       add ebx,ecx
       mov [a],ebx
       nastavi:
       mov edx,0
       mov ebx,10
       idiv ebx
       mov ecx,3
       cmp edx,ecx
       jne nastavi2
       mov ebx,[a]
       mov ecx,1
       add ebx,ecx
       mov [a],ebx
       nastavi2:
       mov ecx,3
       cmp eax,ecx
       jne nastavi3
       mov ecx,1
       mov ebx,[a]
       add ebx,1
       mov [a],ebx
       nastavi3:
       PRINT_DEC 4,a
    xor eax, eax
    ret